import {createStore,ActionContext} from 'vuex'
interface StateType{
    count:number
}
const store=createStore({
    state(){
        return{
            count:0
        }
    },
    mutations:{
        INCREMENT(state:StateType,payload:number){
            state.count+=payload
        }
    },
    actions:{
        incrementAsync(cxt:ActionContext,payload:number){
           setTimeout(() => {
              cxt.commit('INCREMENT',payload)
           }, 1000);
        }
    },
    getters:{
        doubbleCount(state:StateType){
            return state.count*2
        }
    }
})
export default store




